var personerInfo = {
	avatar: "https://we-retail-static-1300977798.cos.ap-guangzhou.myqcloud.com/retail-ui/components-exp/avatar/avatar-1.jpg",
	userName: "Three",
	gender: "男",
	area: "广东省广州市"
};

$(() => {
	initValue();
	initListener();
})

initValue = () => {
	let subLoading = layer.open({
		type: 2,
		shadeClose: false,
		content: '正在加载...'
	});
	
	setTimeout(() => {
		layer.close(subLoading);
		$(`#avatar`).attr('src', personerInfo.avatar);
		$(`#name`).html(personerInfo.userName);
		$(`#area`).html(personerInfo.area);
		
		// 二维码内容  参考：https://blog.csdn.net/lplovewjm/article/details/134524616
		const text = JSON.stringify(personerInfo);
		// 生成二维码
		new QRCode(document.getElementById('qrcode'), {
			text: text,
			width: 300,
			height: 300,
			colorDark: '#000000',
			colorLight: '#ffffff',
			correctLevel: 0, // 二维码结构复杂性 0~3	
		});
		
	}, 500)
	
}

initListener = () => {
	$("#save").on('click', (e) => {
		onSave();
	});
}

onSave = () => {
	let subLoading = layer.open({
		type: 2,
		shadeClose: false,
		content: '正在保存...'
	});
	
	setTimeout(() => {
		layer.close(subLoading);
		showToast('保存成功！')
	}, 500)
}
